<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<include file="Public:base" />
<script type="text/javascript">
$(document).ready(function() {

	$("#userform").validate({
		
		errorPlacement: function (error, element) {
            error.appendTo(element.parent().find('label'));
            element.parent().addClass("has-error");
        },
        //获取焦点时不验证 
        focusInvalid: false,   
        onkeyup: false ,
		//debug:true,
        
	    rules: {
	        'username': {
	            required: true,
	            checkusername:true
	        },
	        'email': {
	            required: true,
	            email:true
	        },
	    },
	    messages: {
	        'username': {
	            required: "请输入昵称 "
	        },
	        'email': {
	            required: "请输入邮箱",
	            email:"邮箱格式错误"
	        },
	    }
	});
	
	
	$("#pwdform").validate({
		
		errorPlacement: function (error, element) {
            error.appendTo(element.parent().find('label'));
            element.parent().addClass("has-error");
        },
        //获取焦点时不验证 
        focusInvalid: false,   
        onkeyup: false ,
	    rules: {
	        'password': {
	            required: true,
	            rangelength:[6,15]
	        }
	    },
	    messages: {
	        'password': {
	            required: "请输入用户密码",
	            rangelength:"密码长度为 6-15位"
	        }
	    }
	});
	
});

</script>
</head>
<body>
<include file="Public:header" />

<div class="home-index">
	<div class="container">
	    <div class="row">
	      <ol class="breadcrumb">
	        <li>首页</li>
	        <li><a class='' href="__URL__/index">管理员管理</a></li>
	        <li class="active">编辑管理员</li>
	      </ol>

		<div class="comm-box">

			<!-- Nav tabs -->
			<ul class="nav nav-tabs mb10">
				<li class="active">
					<a href="#info" data-toggle="tab">个人资料</a>
				</li>
				<li>
					<a href="#password" data-toggle="tab">修改密码</a>
				</li>

			</ul>

			<!-- Tab panes -->
			<div class="tab-content">
				<div class="tab-pane active" id="info">
					<form id="userform" role="form" method="post" action="__URL__/update">
						<div class="form-group">
							<br>
							<label >用户名</label>
							<input type="text" name="username" class="form-control" value='{$data.username}'></div>
						
						<div class="form-group">
							<label >邮箱</label>
							<input type="text" name="email" class="form-control" value='{$data.email}'></div>	
						<input type="hidden" name="id"  value='{$data.id}' >
						<button type="submit" class="btn btn-primary">提交</button>
					</form>

				</div>
				<div class="tab-pane" id="password">
					<form id="pwdform" role="form" method="post" action="__URL__/updatepwd">
	
						<div class="form-group">
						<br>
							<label>新密码</label>
							<input type="password" name="password" class="form-control" placeholder="请输入新密码"></div>
							<input type="hidden" name="id"  value='{$data.id}' >
						<button type="submit" class="btn btn-primary">提交</button>
					</form>

				</div>

			</div>

		</div>
	</div>
</div>
</div>
</body>
</html>